using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using T2.WebSecurity.Data.Controllers.Interfaces;
using T2.WebSecurity.Data.Entities.Interfaces;
using T2.WebSecurity.Business.Entities.Interfaces;
using T2.WebSecurity.Business.Entities;
using T2.WebSecurity.Data.Controllers;
using T2.WebSecurity.Business.Builders.Interface;
using T2.WebSecurity.Business.Translators;
using T2.WebSecurity.Business.Entities.Search.Interfaces;
using T2.WebSecurity.Data.Entities.Search.Interfaces;


//--Change Management Control - Membership Builder  --**********************
//--Created By: trooks
//--Description: Membership Builder Class
//--Created Date: 03/07/2013 10:48:35
//--*************************************************************

namespace T2.WebSecurity.Business.Builders
{
	public partial class Membership_Builder : IMembership_builder 
	{
		
	public List<IMembership_biz> BuildParts (IMembership_biz _param)
	{
			IMembership_biz temp = new Membership_biz();
			IMembershipController cont = new MembershipController();
			List<IMembership_biz> tempList = new List<IMembership_biz>();
			List<IMembership> tempData = new List<IMembership>();
			switch (_param.Action)
			{
				case "GetOne":
				temp = MembershipTranslator.TranslateFromDataLayer(cont.Membership_GetOne(MembershipTranslator.TranslateToDataLayer(_param)));
				tempList.Add(temp);
				return tempList;

				case "GetAll":
				tempData = cont.Membership_GetAll(MembershipTranslator.TranslateToDataLayer(_param));
				tempList = tempData.Select(p => MembershipTranslator.TranslateFromDataLayer(p)).Cast<IMembership_biz>().ToList();
				return tempList;

				case "UserProfile_Membership_ByParent":
				tempData = cont.UserProfile_Membership_ByParent(MembershipTranslator.TranslateToDataLayer(_param));
				tempList = tempData.Select(p => MembershipTranslator.TranslateFromDataLayer(p)).Cast<IMembership_biz>().ToList();
				return tempList;

				case "PasswordQuestion_Membership_ByParent":
				tempData = cont.PasswordQuestion_Membership_ByParent(MembershipTranslator.TranslateToDataLayer(_param));
				tempList = tempData.Select(p => MembershipTranslator.TranslateFromDataLayer(p)).Cast<IMembership_biz>().ToList();
				return tempList;

			}
			return tempList;
}
	public List<IMembership_biz> BuildParts (IMembershipSearch_biz _param)
	{
			IMembership_biz temp = new Membership_biz();
			IMembershipController cont = new MembershipController();
			List<IMembership_biz> tempList = new List<IMembership_biz>();
			List<IMembership> tempData = new List<IMembership>();
			tempData = cont.Membership_Search(MembershipTranslator.TranslateSearchToDataLayer(_param));
			tempList = tempData.Select(p => MembershipTranslator.TranslateFromDataLayer(p)).Cast<IMembership_biz>().ToList();
			return tempList;

	}
		
	}
}
